package com.ikangtai.shecare.record.bean;

import android.content.Context;

import com.ikangtai.shecare.common.db.DBManager;
import com.ikangtai.shecare.common.util.DateUtil;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
 * Created by Administrator on 2016/4/19.
 */
public class UserTemperatureInfo {

    private String temperatureId;
    private String userName;
    private long measureTime;
    private long editTime;
    private double temperature;
    private int isBBT;
    private int type;
    private int syncType;
    private int isDelete;
    public UserTemperatureInfo(){

    }
    public static List<UserTemperatureInfo> getBBTList(Context context, String userName, long startTime, long endTime){
        DBManager dbManager = new DBManager(context);
        return dbManager.getBBTDataList(userName, startTime, endTime);
    }

    public long getEditTime() {
        return editTime;
    }

    public void setEditTime(long editTime) {
        this.editTime = editTime;
    }

    public int getIsBBT() {
        return isBBT;
    }

    public void setIsBBT(int isBBT) {
        this.isBBT = isBBT;
    }

    public int getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(int isDelete) {
        this.isDelete = isDelete;
    }

    public long getMeasureTime() {
        return measureTime;
    }

    public void setMeasureTime(long measureTime) {
        this.measureTime = measureTime;
    }

    public int getSyncType() {
        return syncType;
    }

    public void setSyncType(int syncType) {
        this.syncType = syncType;
    }

    public double getTemperature() {
        return temperature;
    }

    public void setTemperature(double temperature) {
        this.temperature = temperature;
    }

    public String getTemperatureId() {
        return temperatureId;
    }

    public void setTemperatureId(String temperatureId) {
        this.temperatureId = temperatureId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public JSONObject getUserTemperatureInfoJson(){

        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("temperatureID", temperatureId);
            jsonObject.put("basalBodyTempreture", temperature);
            jsonObject.put("temperatureDate", DateUtil.getDateTimeStr2bit(measureTime));
            jsonObject.put("isBBT", isBBT);
            jsonObject.put("temperatureEditDate", DateUtil.getDateTimeStr2bit(editTime));
            jsonObject.put("type", type);
            jsonObject.put("deleted", isDelete);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return jsonObject;
    }

    public boolean isBBT(){
        return isBBT == 1;
    }
}
